<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/layer/layer/mobile/need/layer.css}">
    <script th:src="@{/bootstrap/js/jquery.min.js}"></script>
    <script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/layer/layer/layer.js}"></script>
</head>
<body >
<div style="border: 1px solid grey;margin:70px;height: 500px">
    <h3 style="color: #1E9FFF;margin-left: 40%">八仙过海项目组出品</h3>
    <br>
    <br>
    <h3 style="color: #1E9FFF;margin-left: 46%">修改卡额度</h3>
    <div id="tbody" class="text-center">
        <form class="form-horizontal" role="form">
            <div class="form-group">
                <label class="col-sm-5 control-label">当前最大额度</label>
                <div class="col-sm-3">
                    <h4 th:text="${creditLimit}"></h4>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-4 control-label">请输入您想要额度：</label>
                <div class="col-sm-5">
                    <input type="number" class="form-control" id="limit"
                           placeholder="请输入您想要的额度">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-8">
                    <a href="/credit/test6" id="next2" class="btn-warning btn btn-lg">上一步</a>
                    <button type="button" th:onclick="next3()" id="next1" class="btn-success btn btn-lg">下一步</button>
                </div>
            </div>
        </form>
        <br>
        <br>
    </div>

</div>
</body>
<script th:inline="javascript">
    var ty1=[[${cardnum}]];
    var ty2=[[${creditLimit}]];
    function next3() {
        if($("#limit").val()==""){
            layer.msg("额度不能为空");
        }else if($("#limit").val()<=ty2 && $("#limit").val()>0){
            $.post("/credit/uplimit",
                "cardnum=" + ty1 +
                "&limit=" + $("#limit").val(), function (data) {
                    if (data.code == 200) {
                        layer.msg(data.message);
                    } else {
                        layer.msg(data.message);
                    }
                })
        }else {
            // alert("额度不能大于最大额度或小于0");
            layer.msg("额度不能大于最大额度或小于0");
        }
    }
</script>


</html>